package ioperation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-19
 * Time: 20:34
 */
public class BorrowOperation implements IOperation {
    @Override
    public void work(Booklist booklist) {
        System.out.println("借阅图书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入想要借阅书的名字");
        String name = scanner.nextLine();
        int currentsize = booklist.getUseSize();
        for (int i = 0; i < currentsize; i++) {
            Book book = booklist.getBooks()[i];
            if(book.getName().equals(name)){
                book.setIsboolean(true);
                System.out.println("借阅成功");
            }
        }
        System.out.println("没有你要借的书");
    }
}
